package com.zhixing.utils;

import java.util.function.Function;

/**
 * 字符串工具类
 *
 * @author zhixing
 */
public class StrUtils {

    /**
     * 字符串拼接
     * @param str 需要拼接的字符串
     * @since V2.2
     * @return
     **/
    public static String contractStr(Object ... str){
        return StrUtils.strOperate(value ->{
            StringBuffer sb = new StringBuffer();
            for(int i = 0 ; i< str.length ; i++){
                sb.append(str[i]);
            }
            return sb.toString();
        },str);
    }

    public static String strOperate(Function<Object[], String> function, Object... str){
        return function.apply(str);
    }
}
